{if $full_page}
{include file="taobao_pageheader.htm"}
{insert_scripts files="../../../../js/utils.js,../../../../admin/js/listtable.js"}
<p>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://container.api.taobao.com/container?appkey={$appkey}&encode=utf-8" target="_blank"><font color="#CC0000">{$lang.login_taobao}</font></a>
</p>

<link href="../js/calendar/calendar.css" rel="stylesheet" type="text/css" />
<!-- 订单列表 -->
<form method="post" action="order.php?act=operate" name="listForm" onsubmit="return check()">
  <div class="list-div" id="listDiv">
{/if}
<div class="item-list">
<form id="memoListForm" name="memoListForm" action="" method="post">
<div class="item-list-bd">
<table id="J_ListTable">
  <colgroup>
  <col class="item-list-col0" />
  <col class="item-list-col1" />
  <!-- 宝贝 -->
  <col class="item-list-col2" />
  <!-- 单价(元) -->
  <col class="item-list-col3" />
  <!-- 数量 -->
  <col class="item-list-col4" />
  <!-- 纠纷 -->
  <col class="item-list-col6" />
  <!-- 买家 -->
  <col class="item-list-col7" />
  <!-- 交易状态 -->
  <col class="item-list-col8" />
  <!-- 实收款(元) -->
  <col class="item-list-col9" />
  <!-- 评价 -->
  </colgroup>
  <thead>
    <tr>
      <th></th>
      <th class="item">宝贝</th>
      <th class="price">单价(元)</th>
      <th class="num">数量</th>
      <th class="trouble">售后</th>
      <th class="contact">买家</th>
      <th class="trade-status">交易状态</th>
      <th class="order-price">实收款(元)</th>
      <th class="remark">评价</th>
    </tr>
  </thead>
  {foreach from=$order_list item=order key=okey}
<tbody id="order{$order.tid}" class="order">
    <tr class="sep-row">
      <td colspan="9"></td>
    </tr>
    <tr class="order-hd">
      <td colspan="9"><input class="selector" type="checkbox" id="cb{$order.tid}" name="biz_order_id" value="{$order.tid}" />
        <div class="basic-info"><span class="order-num">
          <label for="cb145753424627296">订单编号：{$order.tid}</label>
        </span><span class="deal-time">成交时间：{$order.created}</span></div>
        <div class="more-info"></div>
        <input type="hidden" name="sellerId" value="" />
      <input type="hidden" name="buyerId" value="" /></td>
    </tr>
    <!--start 子订单list  start-->
    <tr id="item{$order.tid}" class="order-item
																        					        				last
		        			">
      <td colspan="2" class="item"><div class="pic-info">
          <div class="pic s50"><a hidefocus="true" target="_blank" title="查看宝贝详情" href="http://trade.taobao.com/trade/detail/trade_snap.htm?tradeID={$order.pic_path}"><img alt="查看宝贝详情" src="{$order.pic_path}" /></a></div>
        </div>
        <div class="txt-info">
          <div class="desc"><a hidefocus="true" href="http://trade.taobao.com/trade/detail/trade_snap.htm?tradeID={$order.pic_path}" title="查看宝贝详情" target="_blank">{$order.title}</a><span class="good-icons"></span></div>
        </div></td>
      <td class="price" title="{$order.payment}">{$order.payment}</td>
      <td class="num" title="{$order.num}">{$order.num}</td>
      <td class="trouble"><a class="J_HasBuy J_ApplyRepayTrigger" title="" target="_blank" url="http://support.taobao.com/myservice/rights/rights_redirect.jhtml?trade_id={$order.tid}&amp;type=1">投诉维权</a></td>
      <td class="contact" rowspan="1" sumrows="1"><a class="nickname" href="#" target="_blank">{$order.buyer_nick}</a></td>
      <td class="trade-status" rowspan="1" sumrows="1"><a href="#" target="_blank"><strong class="J_TradeStatus status todo h">{$order.status}</strong></a><a href="order.php?act=order_detail&tid={$order.tid}" class="detail-link" target="_blank">详情</a>
      <div class="trade-actions"><span class="skin-blue"><a class="small-btn" href="order.php?act=dodelivery&tid={$order.tid}" target="_blank">发货</a></span></div></td>
      <td class="order-price" rowspan="1" sumrows="1"><strong class="J_OrderPrice">{$order.payment}</strong>
      <div class="post-info"><span class="post-type">($order.post_fee)</span></div></td>
      <td class="remark" rowspan="1" sumrows="1"></td>
    </tr>
    <!--end 子订单list  end-->
  </tbody>  
  {/foreach}
</table>
</div>
</form>
</div>

<!-- 分页 -->
<table id="page-table" cellspacing="0">
  <tr>
    <td align="right" nowrap="true">
    {include file="page.htm"}
    </td>
  </tr>
</table>

{if $full_page}
  </div>
  <div>

<!--    <input name="remove" type="submit" id="btnSubmit3" value="{$lang.remove}" class="button" disabled="true" onclick="this.form.target = '_self'" />

    <input name="batch" type="hidden" value="1" />
    <input name="order_id" type="hidden" value="" />-->
  </div>
</form>
<script language="JavaScript">
listTable.recordCount = {$record_count};
listTable.pageCount = {$page_count};

{foreach from=$filter item=item key=key}
listTable.filter.{$key} = '{$item}';
{/foreach}
{literal}

    onload = function()
    {
        // 开始检查订单
        startCheckOrder();
    }

    /**
     * 搜索订单
     */
    function searchOrder()
    {
        listTable.filter['order_sn'] = Utils.trim(document.forms['searchForm'].elements['order_sn'].value);
        listTable.filter['consignee'] = Utils.trim(document.forms['searchForm'].elements['consignee'].value);
        listTable.filter['composite_status'] = document.forms['searchForm'].elements['status'].value;
        listTable.filter['page'] = 1;
        listTable.loadList();
    }

    function check()
    {
      var snArray = new Array();
      var eles = document.forms['listForm'].elements;
      for (var i=0; i<eles.length; i++)
      {
        if (eles[i].tagName == 'INPUT' && eles[i].type == 'checkbox' && eles[i].checked && eles[i].value != 'on')
        {
          snArray.push(eles[i].value);
        }
      }
      if (snArray.length == 0)
      {
        return false;
      }
      else
      {
        eles['order_id'].value = snArray.toString();
        return true;
      }
    }
    /**
     * 显示订单商品及缩图
     */
    var show_goods_layer = 'order_goods_layer';
    var goods_hash_table = new Object;
    var timer = new Object;

    /**
     * 绑定订单号事件
     *
     * @return void
     */
    function bind_order_event()
    {
        var order_seq = 0;
        while(true)
        {
            var order_sn = Utils.$('order_'+order_seq);
            if (order_sn)
            {
                order_sn.onmouseover = function(e)
                {
                    try
                    {
                        window.clearTimeout(timer);
                    }
                    catch(e)
                    {
                    }
                    var order_id = Utils.request(this.href, 'order_id');
                    show_order_goods(e, order_id, show_goods_layer);
                }
                order_sn.onmouseout = function(e)
                {
                    hide_order_goods(show_goods_layer)
                }
                order_seq++;
            }
            else
            {
                break;
            }
        }
    }
    listTable.listCallback = function(result, txt) 
    {
        if (result.error > 0) 
        {
            alert(result.message);
        }
        else 
        {
            try 
            {
                document.getElementById('listDiv').innerHTML = result.content;
                bind_order_event();
                if (typeof result.filter == "object") 
                {
                    listTable.filter = result.filter;
                }
                listTable.pageCount = result.page_count;
            }
            catch(e)
            {
                alert(e.message);
            }
        }
    }
    /**
     * 浏览器兼容式绑定Onload事件
     *
     */
    if (Browser.isIE)
    {
        window.attachEvent("onload", bind_order_event);
    }
    else
    {
        window.addEventListener("load", bind_order_event, false);
    }

    /**
     * 建立订单商品显示层
     *
     * @return void
     */
    function create_goods_layer(id)
    {
        if (!Utils.$(id))
        {
            var n_div = document.createElement('DIV');
            n_div.id = id;
            n_div.className = 'order-goods';
            document.body.appendChild(n_div);
            Utils.$(id).onmouseover = function()
            {
                window.clearTimeout(window.timer);
            }
            Utils.$(id).onmouseout = function()
            {
                hide_order_goods(id);
            }
        }
        else
        {
            Utils.$(id).style.display = '';
        }
    }

    /**
     * 显示订单商品数据
     *
     * @return void
     */
    function show_order_goods(e, order_id, layer_id)
    {
        create_goods_layer(layer_id);
        $layer_id = Utils.$(layer_id);
        $layer_id.style.top = (Utils.y(e) + 12) + 'px';
        $layer_id.style.left = (Utils.x(e) + 12) + 'px';
        if (typeof(goods_hash_table[order_id]) == 'object')
        {
            response_goods_info(goods_hash_table[order_id]);
        }
        else
        {
            $layer_id.innerHTML = loading;
            Ajax.call('order.php?is_ajax=1&act=get_goods_info&order_id='+order_id, '', response_goods_info , 'POST', 'JSON');
        }
    }

    /**
     * 隐藏订单商品
     *
     * @return void
     */
    function hide_order_goods(layer_id)
    {
        $layer_id = Utils.$(layer_id);
        window.timer = window.setTimeout('$layer_id.style.display = "none"', 500);
    }

    /**
     * 处理订单商品的Callback
     *
     * @return void
     */
    function response_goods_info(result)
    {
        if (result.error > 0)
        {
            alert(result.message);
            hide_order_goods(show_goods_layer);
            return;
        }
        if (typeof(goods_hash_table[result.content[0].order_id]) == 'undefined')
        {
            goods_hash_table[result.content[0].order_id] = result;
        }
        Utils.$(show_goods_layer).innerHTML = result.content[0].str;
    }

</script>
{/literal}

{include file="taobao_pagefooter.htm"}
{/if}